//
// Solver.hpp for  in /home/herpec_j/Dropbox/Projets/raytracer-2016/Includes/Maths/
//
// Made by Jonathan
// Login   <ledey_l@epitech.net>
//
// Started on  Sat Sep 21 23:17:27 2013 Jonathan
// Last update Sun Sep 22 17:05:24 2013 Jonathan
//

#ifndef			SOLVER_HPP_
# define		SOLVER_HPP_

# include		<cmath>

# include		"Maths/Constants.hpp"

# define		EQN_EPS		(1e-90)
# define		IS_ZERO(X)	((X) > -EQN_EPS && (X) < EQN_EPS)
# define		CBRT(X)		((X) > 0.0 ? pow(static_cast<long double>(X), 1.0 / 3.0) \
					 : ((X) < 0.0 ? -pow(static_cast<long double>(-(X)), 1.0 / 3.0) \
					    : 0.0))

namespace		Maths
{
  class			Solver
  {
  private:
    Solver(void);
    Solver(Solver const &rOther);
    Solver		&operator=(Solver const &rOther);
    ~Solver(void);

  protected:

  public:
    static int		SolveQuadric(long double rCoeff[3], long double rSolutions[2]);
    static int		SolveCubic(long double rCoeff[4], long double rSolutions[3]);
    static int		SolveQuartic(long double rCoeff[5], long double rSolutions[4]);
  };
};

#endif			/* SOLVER_HPP_ */
